#!/usr/bin/env python
#coding=utf-8

import sqlite3

con=sqlite3.connect('bible_new.db')
cur = con.cursor()

file = open('cuvs.txt')
lines = file.readlines()

lastBook=''
bookid=0
for line in lines:
	line2 = line.split(' ',1)
	front = line2[0].split('.')
	chapterid = int(front[1])
	if front[0]!=lastBook :
		bookid = bookid+1
		lastBook = front[0]
	verseid = int(front[2])
	chapterid = int(front[1])
	cur.execute("insert into verse(bookid,chapterid,verseid,content,version) values (?,?,?,?,?)",(bookid,chapterid,verseid,unicode(line2[1],'utf-8'),'CUVS'))

con.commit()
